package lianxi;

import java.util.Iterator;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        TreeSet<Student> treeSet = new TreeSet<>();
        Student stu1 = new Student("xiaoming",100,100,100);
        Student stu2 = new Student("aqiang",100,100,100);
        Student stu3 = new Student("dudu",100,100,100);
        treeSet.add(stu1);
        treeSet.add(stu2);
        treeSet.add(stu3);
        Iterator<Student> iterator = treeSet.iterator();
        while (iterator.hasNext()){
            Student next = iterator.next();
            System.out.println(next);
        }
        for (Student student : treeSet) {
            System.out.println(student);
        }
    }
}
